<div>
    <div class="row justify-content-center">
        <div class="col-md-8">
            <h1>重置您的密码</h1>

            <jhi-alert-error></jhi-alert-error>

            <div class="alert alert-warning" *ngIf="!success">
                <span>请输入您注册时使用的电子邮箱地址。</span>
            </div>

            <div class="alert alert-success" *ngIf="success">
                <span>请查看您的邮箱，了解如何重置密码的详细信息。</span>
            </div>

            <form *ngIf="!success" name="form" role="form" (ngSubmit)="requestReset()" [formGroup]="resetRequestForm">
                <div class="form-group">
                    <label class="form-control-label" for="email">电子邮箱</label>
                    <input type="email" class="form-control" id="email" name="email" placeholder="您的电子邮箱"
                           formControlName="email" #email>

                    <div *ngIf="resetRequestForm.get('email')!.invalid && (resetRequestForm.get('email')!.dirty || resetRequestForm.get('email')!.touched)">
                        <small class="form-text text-danger"
                               *ngIf="resetRequestForm.get('email')?.errors?.required">
                            电子邮箱是必填项。
                        </small>

                        <small class="form-text text-danger"
                               *ngIf="resetRequestForm.get('email')?.errors?.email">
                            电子邮箱格式无效。
                        </small>

                        <small class="form-text text-danger"
                               *ngIf="resetRequestForm.get('email')?.errors?.minlength">
                            电子邮箱至少需要5个字符。
                        </small>

                        <small class="form-text text-danger"
                               *ngIf="resetRequestForm.get('email')?.errors?.maxlength">
                            电子邮箱不能超过100个字符。
                        </small>
                    </div>
                </div>
                <button type="submit" [disabled]="resetRequestForm.invalid" class="btn btn-primary">重置</button>
            </form>
        </div>
    </div>
</div>
